package homework2;
//创建一个Employee类，其中包含姓名、年龄和工资的私有实例变量。实现计算工资和显示员工信息的方法。
// 使用静态变量跟踪员工总数。为不同类型的雇员(例如，经理、工程师)创建子类，这些子类具有计算工资的特定行为。
public class Employee {

    private String name;
    private int age;
    private double salary;
    private static int employeeCount = 0;

    public Employee() {
    }

    public Employee(String name, int age, double salary) {
        this.name = name;
        this.age = age;
        this.salary = salary;
        employeeCount++;
    }
    //计算工资的  方法
    public double calculateSalary() {
        return salary;
    }
    //显示员工信息的方法。
    public void displayInfo() {
        System.out.println("姓名：" + name);
        System.out.println("年龄：" + age);
        System.out.println("工资：" + salary);
    }
    //使用静态变量跟踪员工总数
    public static int getEmployeeCount() {
        return employeeCount;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
}
